import { defineStore } from "pinia";

export const useUserInfoStore = defineStore("userInfo", {
  state: () => ({
    token: null,
    basicInfo: {
      name: "",
      avatar: "",
      email: "",
    },
    roles: [],
    asyncRoutes: [],
    routes: [],
  }),
  actions: {
    setToken(token) {
      this.token = token;
    },
    setBasicInfo(basicInfo) {
      this.basicInfo = basicInfo;
    },
    setRoles(roles) {
      this.roles = roles;
    },
    setRoutes(routes) {
      this.routes = routes;
    },
    setAsyncRoutes(asyncRoutes) {
      this.asyncRoutes = asyncRoutes;
    },
  },
});
